import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';
import locale from 'element-ui/lib/locale/lang/zh-CN'
import VueRouter from 'vue-router'

import axios from 'axios'
// import VueAxios from 'vue-axios'
Vue.prototype.$axios = axios

axios.defaults.baseURL = '/api'
axios.defaults.headers.post['Content-Type'] = 'application/json';

const Routers = [
  {
    path: '*',
    component: (resolve) => require(['./views/index.vue'], resolve)
  },
  {
    path: '/index',
    component: (resolve) => require(['./views/index.vue'], resolve)
  },
  {
    path: '/about',
    component: (resolve) => require(['./views/about.vue'], resolve)
  },
  {
    path: '/skuQuery',
    component: (resolve) => require(['./views/skuQuery.vue'], resolve)
  }
  ,
  {
    path: '/test3',
    component: (resolve) => require(['./views/test3.vue'], resolve)
  }
  ,
  {
    path: '/test4',
    component: (resolve) => require(['./views/test4.vue'], resolve)
  }
  ,
  {
    path: '/404',
    component: (resolve) => require(['./views/404.vue'], resolve)
  }
]

const RouterConfig = {
  mode: 'history',
  routes: Routers
}

const router = new VueRouter(RouterConfig);

// Vue.use(Element, { size: 'small', zIndex: 3000 });
Vue.use(ElementUI, { locale })
Vue.use(ElementUI);
Vue.use(VueRouter)
Vue.use(axios)

new Vue({
  el: '#app',
  router: router,
  render: h => h(App)
});